package exp07gui.mvc;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * java swing的一种MVC编程模式
 *
 * View 层只需要设置图形的界面即可，现在大部分被web层代替
 */
public class View extends JFrame {
    JTextField jTextFieldA;
    JTextField jTextFieldB;
    JButton jButtonEqual;
    JLabel jLabelResult;

    public View() {
        setLayout(new FlowLayout());
        this.add(jTextFieldA = new JTextField(10));
        this.add(new JLabel("+"));
        this.add(jTextFieldB = new JTextField(10));
        this.add(jButtonEqual = new JButton("="));

        this.add(jLabelResult = new JLabel("N/A"));

        this.setResizable(false);// 禁用最大化按钮
        this.pack();
        setTitle("My Calculator ver 0.1a");
        setVisible(true);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }



}